
<div class="form">
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'tim-form',
	'enableAjaxValidation'=>true,
	'clientOptions'=>array('validateOnSubmit'=>true),
        'method'=>'post',
	'type'=>'horizontal',
	'htmlOptions'=>array(
		'enctype'=>'multipart/form-data',
		'onsubmit'=>'return validateFormUpdate()'
	)
)); 
	$modelKeg = Kegiatan::model()->findByPk($_GET['id_kegiatan']);
	?>
     	<fieldset>
		<legend>
			
		</legend>

	<?php echo $form->errorSummary($model,'Opps!!!', null,array('class'=>'alert alert-error span12')); ?>
        		
   <div class="control-group">		
			<div class="span4" style="width:100%">
				<div class="formSidelw">
					<?php echo $form->hiddenField($model,'id_kegiatan',array('value'=>$modelKeg->id_kegiatan)); ?>
					<?php echo $form->textFieldRow($modelKeg,'no_keg',array('class'=>'span5','disabled'=>'true')); ?>
					<?php echo $form->dropDownListRow($model,'id_provinsi',CHtml::listData(Provinsi::model()->findAll(), 'id_provinsi', 'nama_prov'),array('class'=>'span5','empty'=>'Select Provinsi')); ?>
					<div class="control-group">
						<?php 
						if($model->tgl_mulai!='')$model->tgl_mulai = date("d/m/Y",strtotime($model->tgl_mulai ));
						echo $form->labelEx($model,'tgl_mulai',array('class'=>'control-label')); ?>
						<div class="controls">
						<?php
						$this->widget('zii.widgets.jui.CJuiDatePicker', array(
							'model'=>$model,
							'attribute'=>'tgl_mulai',
							'htmlOptions'=>array(
								'class'=>'span5'
							),
							'options'=>array(
								'dateFormat'=>'dd/mm/yy',
								'showAnim'=>'slide',
								'changeMonth'=>true,
								'changeYear'=>true,
								'onClose'=> "js:function( selectedDate ) {
									$( '#Tim_tgl_berakhir' ).datepicker('option', 'minDate', selectedDate );
								}"
							),
							
						));
						?>
						<?php echo $form->error($model,'tgl_mulai'); ?>
					</div>
				</div>
				<div class="control-group">
					<?php 
					if($model->tgl_berakhir!='')$model->tgl_berakhir = date("d/m/Y",strtotime($model->tgl_berakhir ));
					echo $form->labelEx($model,'tgl_berakhir',array('class'=>'control-label')); ?>
					<div class="controls">
					<?php
					$this->widget('zii.widgets.jui.CJuiDatePicker', array(
						'model'=>$model,
						'attribute'=>'tgl_berakhir',
						'htmlOptions'=>array(
							'class'=>'span5'
						),
						'options'=>array(
							'dateFormat'=>'dd/mm/yy',
							'showAnim'=>'slide',
							'changeMonth'=>true,
							'changeYear'=>true,
							'onClose'=> "js:function( selectedDate ) {
								$( '#Tim_tgl_mulai' ).datepicker( 'option', 'maxDate', selectedDate );
								if($('#Tim_tgl_mulai').val()){
									haricount=getDays($('#Tim_tgl_mulai').val(),$('#Tim_tgl_berakhir').val());
									$('#jmlh').val(haricount);
								}
								
							}"
						), 
						
					));
					?>
					<?php echo $form->error($model,'tgl_berakhir'); ?>
					</div>
				</div>
				<div class="control-group ">
					<label for="harian" class="control-label required">
						Jumlah Hari
					</label>
					<div class="controls">
					<input type="text" id="jmlh" class="span5" disabled=true>
					</div>
				</div>
				
				<?php echo $form->dropDownListRow($model,'id_transport',CHtml::listData(Transport::model()->findAll(), 'id_transport', 'description'),array('class'=>'span5','empty'=>'Select Transport')); ?>
				<?php echo $form->textFieldRow($model,'biaya_trans',array('class'=>'span5','prepend'=>'Rp','append'=>',00')); ?>
				<?php echo $form->textFieldRow($model,'airportax',array('class'=>'span5','disabled'=>'true','prepend'=>'Rp','append'=>',00')); ?>
				<?php echo $form->textFieldRow($model,'riil',array('class'=>'span5','prepend'=>'Rp','append'=>',00')); ?>
				</div>
				
				<div class="formSiderw">
					<?php //echo $form->dropDownListRow($model,'id_kary',CHtml::listData(Karyawan::model()->findAll(), 'id_kary', 'nama'),array('class'=>'span5','empty'=>'Select Type Karyawan')); ?>
					<div class="control-group ">
						<label for="namakar" class="control-label required">
							Karyawan
						</label>
						<div class="controls">
							<?php 
								echo $form->hiddenField($model,'id_kary'); 
								$karyawan = Karyawan::model()->findByPk($model->id_kary)->nama;
								echo CHtml::textField('namakar', $karyawan, array('class'=>'span5','readonly'=>true));
								$this->widget('bootstrap.widgets.TbLabel', array(
									'type'=>'important',
									'label'=>'F4 Search',
								));
							?>
						</div>
					</div>
					<div id="hidtim">
						<div class="control-group ">
							<label for="harian" class="control-label required">
								Type Dinas
							</label>
							<div class="controls">
							<input type="text" id="tpd" class="span5" disabled=true>
							</div>
						</div>
						<div class="control-group ">
							<label for="harian" class="control-label required">
								Biaya Harian
							</label>
							<div class="controls input-prepend input-append">
							<span class="add-on">Rp</span>
							<input type="text" id="harian" class="span5" disabled=true>
							<span class="add-on">,00</span>
							</div>
						</div>
						<div class="control-group ">
							<label for="inap" class="control-label required">
								Biaya Penginapan
							</label>
							<div class="controls input-prepend input-append">
							<span class="add-on">Rp</span>
							<input type="text" id="inap" class="span5" disabled=true>
							<span class="add-on">,00</span>
							</div>
						</div>
						<div class="control-group ">
							<label for="total" class="control-label required">
								Total * jml Hari
							</label>
							<div class="controls input-prepend input-append">
							<span class="add-on">Rp</span>
							<input type="text" id="total" class="span5" disabled=true>
							<span class="add-on">,00</span>
							</div>
							<input id="totalAwal" type="hidden">
						</div>
					</div>
					<?php echo $form->textAreaRow($model,'descrip_tim',array('rows'=>6, 'cols'=>50,'style'=>'width: 222px; height: 109px;', 'class'=>'span8')); ?>
				</div>
           </div>   
  </div>

	<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
                        'icon'=>'ok white',  
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
		)); ?>
              <?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'reset',
                        'icon'=>'remove',  
			'label'=>'Reset',
		)); ?>
	</div>
</fieldset>

<?php $this->endWidget(); ?>

</div>
<?php $this->beginWidget('bootstrap.widgets.TbModal', array(
			'id'=>'winKary',
			'htmlOptions'=>array('style'=>'width:800px'),
)); ?>
<?php $this->endWidget(); ?>
<script>
	var idkar='<?php echo $model->id_kary ;?>';
	var tgl_mulai='<?php echo $model->tgl_mulai ;?>';
	var tgl_berakhir='<?php echo $model->tgl_berakhir ;?>';
</script>
<script src="<?php echo Yii::app()->baseUrl; ?>/addon/js_modul/tim/timEdit.js"></script>
<script src="<?php echo Yii::app()->baseUrl; ?>/addon/js_modul/tim/tim.js"></script>
